package com.xjiuge.fruit.common;

public class ResponseCodeConstant {
	
	public static enum Common{
		success(0,"请求成功"),
		crowd(1,"另一台设备登录"),
		token_not_exist(2,"用户登录令牌不存在"),
		token_error(3,"用户登录令牌未授权或已过期"),
		sso_permission_error(4,"没有访问权限"),
		param_exception(5, "参数异常"),
		error(10,"程序异常"),
		Business_exception(20,"业务异常"),
		Business_user_not_exist(21,"用户不存在"),
		Business_user_password_error(22,"密码错误"),
		Business_user_disable(23,"用户已停用");
		
		private final int code;
		private final String value;
		
		Common(int code, String value) {
			this.code = code;
			this.value = value;
		}
		
		public final int getCode() {
			return code;
		}
		public final String getValue() {
			return value;
		}
		
		public static String getValueByCode(int code){
			for (Common i : Common.values()) {
				if(i.getCode() == code){
					return i.getValue();
				}
			}
			return "";
		}
	}
}